package com.crm.action;

import java.util.List;

import com.crm.pojo.Book;
import com.crm.service.BookService;
import com.opensymphony.xwork2.ActionSupport;

public class BookAction extends ActionSupport{

	private static final long serialVersionUID = 1L;
	
	private BookService bookService;
	
	private int id;
	private Book book;
	private List<Book> bookList;
	
	
	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}
	
	public String findAll(){
		bookService.findAll();
		return SUCCESS;
	}
	public String del() throws Exception{
		bookService.del(id);
		return SUCCESS;
	}
	public String add(){
		return SUCCESS;
	}
	public String save(){
		bookService.save(book);
		return SUCCESS;
	}
	public String edit(){
		book = bookService.findById(id);
		return SUCCESS;
	}
	
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Book getBook() {
		return book;
	}

	public void setBook(Book book) {
		this.book = book;
	}

	public List<Book> getBookList() {
		return bookList;
	}

	public void setBookList(List<Book> bookList) {
		this.bookList = bookList;
	}

	public BookService getBookService() {
		return bookService;
	}
	public void setBookService(BookService bookService) {
		this.bookService = bookService;
	}
	
}
